package extensions.packet;

import java.io.IOException;

import extensions.games.TanquesGame;
import extensions.romario.packet.Packets;

public class MoveTankPacket extends ClientPacket {

    private static final byte MOVE_UP = 1;
    private static final byte MOVE_DOWN = 2;
    private static final byte MOVE_RIGHT = 3;
    private static final byte MOVE_LEFT = 4;
    private byte _move;

    public MoveTankPacket() {
        super(Packets.PACKET_MOVE_TANK);
    }

    public MoveTankPacket(byte move) {
        this();
        _move = move;
    }

    @Override
    public void readContent() throws IOException {
        _move = readByte();
    }

    @Override
    public void writeContent() throws IOException {
        writeByte(_move);
    }

    @Override
    public void runContent() {

        TanquesGame game = getServer().getGame();

        //Tank tank = game.getTank

        switch (_move) {
            case MOVE_UP:
                //game.move
                break;
            case MOVE_DOWN:

                break;
            case MOVE_RIGHT:

                break;
            case MOVE_LEFT:

                break;
            default:
                throw new IllegalArgumentException("Argument _move is invalid (" + _move + ")");
        }
    }
}
